#pragma once

#include "RenderSystem.h"
#include "IEventListener.h"

struct SDL_Renderer;
class CameraComponent;

namespace ZeEngine
{
    class Subject;
}

class GameStateRenderSystem : public ZeEngine::RenderSystem, public ZeEngine::IEventListener
{
public:
    GameStateRenderSystem();
    virtual ~GameStateRenderSystem();

    //IComponentSystem
    virtual bool Init(ZeEngine::GameEngine& gameEngine) override;
    virtual void Render(SDL_Renderer& renderer, ZeEngine::GameEngine& gameEngine, float interpolation) override;
    virtual void Destroy(ZeEngine::GameEngine& gameEngine) override;

    //IEventListener
    virtual bool HandleEvent(const Event& evt) override;
private:

    void RenderTopViewport(SDL_Renderer& renderer, ZeEngine::EntityManager& entityManager, float interpolation);
    void RenderBottomViewport(SDL_Renderer& renderer, ZeEngine::EntityManager& entityManager, float interpolation);
    void RenderEntity(SDL_Renderer& renderer, float interpolation, ZeEngine::Entity* pEntity, CameraComponent* pCameraComponent, u32 viewPortID);

    ZeEngine::Vector2D<float> m_screenResolution;

    std::vector<SDL_Rect> m_viewports;

private:
    CameraComponent* m_pGaulemCameraComponent;
    CameraComponent* m_pBaseCameraComponent;

	u32 m_topViewPort;
	u32 m_bottomViewPort;
};

